/*
 * @Descripttion: GGB
 * @version: 1.0
 * @Author: GGB
 * @Date: 2022-01-30 11:15:35
 * @LastEditors: GGB
 * @LastEditTime: 2022-02-01 21:47:13
 */
const { BrowserWindow } = require('electron')
class AppWindow extends BrowserWindow { 
    constructor(config, urlLocation) { 
        const basicConfig = {
            width: 800,
            height: 600,
            webPreferences: {
                nodeIntegration: true, // 是否集成 Nodejs 
                contextIsolation: false,
                enableRemoteModule: true
            },
            show: false,
            backgroundColor:'#efefef'
        }
        const finalConfig = { ...basicConfig, ...config }
        // 配置顶层的 BrowserWindow 的config
        super(finalConfig)
       this.loadURL(urlLocation)
        this.once('ready-to-show', () => { 
            this.show()
        })
    }
}

module.exports=AppWindow
